@extends('back.adminbase')
@section('content')
    <section class="hbox stretch">
        @include("back.public.left")

        <aside>
            <section class="vbox">

                <header class="header bg-white b-b clearfix">
                    <form class="talbe-search" method="get" action="">
                        <div class="row m-t-sm">
                            <div class="col-sm-12 m-b-xs">
                                <div class="btn-group" role="group">
                                    <strong style="line-height:30px;">添加图书类型</strong>
                                </div>
                                <div class="btn-group pull-right">
                                    <a role="button" class="btn btn-info btn-sm " title="返回" onclick="history.back()">
                                        <i class="glyphicon glyphicon-arrow-left"></i>&nbsp;返回
                                    </a>
                                </div>
                            </div>
                        </div>
                    </form>
                </header>
                <section class="scrollable  wrapper w-f">
                    <section class="panel panel-default ">
                        <div class="row m-l-none m-r-none bg-light lter">
                            <div class="container" style="padding: 20px 0px">
                                <form id="formclass" class="form-horizontal" style="padding-top: 15px;">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">图书类型<span class="red"></span></label>
                                        <div class="col-sm-4 ">
                                            <input type="text" class="form-control" name="book_type"
                                                   placeholder="请输入名称">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label"></label>
                                        <div class="col-sm-2 ">
                                            <button role="button" class="btn btn-default" addparm="" type="submit">提交</button>
                                            <input type="checkbox" id="back">
                                            <label for="back">返回列表</label>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>

                    </section>
                </section>


            </section>
        </aside>
    </section>
@endsection
@section('addscript')
    <script src="{{ url('/') }}/laydate/laydate.js"></script>
    <script>
        var load;
        $(function(){
            $("#formclass").submit(function(e){
                var data = $(this).serialize();
                e.preventDefault();
                $.ajax({
                    url:"{{ url('back/book/createType') }}",
                    type:"post",
                    dataType:"json",
                    data:data,
                    success:function(data){
                        layer.close(load);
                        layer.msg(data.msg);
                        location.href = '{{ url('back/book/bookType') }}';
                    },
                    error:function(data){
                        layer.close(load);
                        layer.msg(data.responseJSON.msg,{icon:5});
                    }
                })
            })


        });
    </script>
@endsection
